---
import { CollectionEntry, getCollection } from "astro:content";
import { StoreSchema } from "../../content/config";
import StoreItemLayout from "../../layouts/StoreItemLayout.astro";

export async function getStaticPaths() {
  const itemEntries = await getCollection("store");
  return itemEntries.map((entry) => ({
    params: { slug: entry.slug },
    props: { entry },
  }));
}

interface Props {
  entry: CollectionEntry<"store">;
}

const { entry } = Astro.props;
const item: StoreSchema = entry.data;
const { Content } = await entry.render();
---

<StoreItemLayout
  title={item.title}
  description={item.description}
  heroImage={item.heroImage}
  updatedDate={item.updatedDate}
  heroImage={item.heroImage}
  pricing={item.pricing}
  oldPricing={item.oldPricing}
  checkoutUrl={item.checkoutUrl}
  badge={item.badge}
  custom_link={item.custom_link}
  custom_link_label={item.custom_link_label}
>
  <Content />
</StoreItemLayout>
